package com.liukang.search.mq;

import com.liukang.search.constatnts.MqConstants;
import com.liukang.search.service.ISearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ItemListener {
    @Autowired
    private ISearchService searchService;

    @RabbitListener(queues = MqConstants.ITEM_INSERT_QUEUE)
    public void listenItemInsert(Long id){
        searchService.insertStatusById(id);
    }

    @RabbitListener(queues = MqConstants.ITEM_DELETE_QUEUE)
    public void listenItemDelete(Long id){
        searchService.deleteStatusById(id);
    }
}
